/*******************************************************************************
 *
 * Copyright (c) 2008-2011 ayound@gmail.com, guwei8576431@gmail.com
 * This program and the accompanying materials
 * are made available under the terms of the GNU GENERAL PUBLIC LICENSE 
 * which accompanies this distribution, and is available at
 * http://dev.perl.org/licenses/gpl1.html
 * All rights reserved.
 * 
 * Created on 2009-11-8
 *******************************************************************************/

package org.cgtw.scriptprofile.ui;

import java.awt.BorderLayout;
import java.io.File;

import javax.swing.JFrame;

import org.cgtw.scriptprofile.widget.ResourceEditor;

public class ResourceView extends JFrame {
	private ResourceEditor editor;
	
	public ResourceView(String url, int line){
		if(url.toLowerCase().endsWith("js")){
			editor = new ResourceEditor("text/javascript");
		}else{
			editor = new ResourceEditor("text/html");
		}
		editor.openFile(new File(url));
		editor.focus(line);
		getRootPane().setLayout(new BorderLayout());//.add(editor);
		getRootPane().add(editor, BorderLayout.CENTER);
		setSize(500, 500);
		setVisible(true);
		doLayout();
	}

}
